home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / Sound.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  21.0 KB  |  636 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Sound.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __SOUND__
  18. #define __SOUND__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if GENERATINGPOWERPC
  35. #pragma options align=mac68k
  36. #endif
  37.  
  38. #ifdef __CFM68K__
  39. #pragma lib_export on
  40. #endif
  41.  
  42. #define twelfthRootTwo 1.05946309434
  43. enum {
  44.     soundListRsrc                = 'snd ',                        /*Resource type used by Sound Manager*/
  45.     kSoundHardwareType            = 'sdev',                        /*component type for sound devices*/
  46.     rate44khz                    = 0xAC440000L,                    /*44100.00000 in fixed-point*/
  47.     rate22050hz                    = 0x56220000L,                    /*22050.00000 in fixed-point*/
  48.     rate22khz                    = 0x56EE8BA3L,                    /*22254.54545 in fixed-point*/
  49.     rate11khz                    = 0x2B7745D1L,                    /*11127.27273 in fixed-point*/
  50.     rate11025hz                    = 0x2B110000,                    /*11025.00000 in fixed-point*/
  51. /*synthesizer numbers for SndNewChannel*/
  52.     squareWaveSynth                = 1,                            /*square wave synthesizer*/
  53.     waveTableSynth                = 3,                            /*wave table synthesizer*/
  54.     sampledSynth                = 5,                            /*sampled sound synthesizer*/
  55. /*old Sound Manager MACE synthesizer numbers*/
  56.     MACE3snthID                    = 11,
  57.     MACE6snthID                    = 13,
  58.     kMiddleC                    = 60,                            /*MIDI note value for middle C*/
  59.     kSimpleBeepID                = 1,                            /*reserved resource ID for Simple Beep*/
  60.     kFullVolume                    = 0x0100,                        /*1.0, setting for full hardware output volume*/
  61.     kNoVolume                    = 0,                            /*setting for no sound volume*/
  62. /*command numbers for SndDoCommand and SndDoImmediate*/
  63.     nullCmd                        = 0,
  64.     initCmd                        = 1,
  65.     freeCmd                        = 2,
  66.     quietCmd                    = 3,
  67.     flushCmd                    = 4,
  68.     reInitCmd                    = 5,
  69.     waitCmd                        = 10,
  70.     pauseCmd                    = 11,
  71.     resumeCmd                    = 12,
  72.     callBackCmd                    = 13
  73. };
  74.  
  75. enum {
  76.     syncCmd                        = 14,
  77.     availableCmd                = 24,
  78.     versionCmd                    = 25,
  79.     totalLoadCmd                = 26,
  80.     loadCmd                        = 27,
  81.     freqDurationCmd                = 40,
  82.     restCmd                        = 41,
  83.     freqCmd                        = 42,
  84.     ampCmd                        = 43,
  85.     timbreCmd                    = 44,
  86.     getAmpCmd                    = 45,
  87.     volumeCmd                    = 46,                            /*sound manager 3.0 or later only*/
  88.     getVolumeCmd                = 47,                            /*sound manager 3.0 or later only*/
  89.     waveTableCmd                = 60,
  90.     phaseCmd                    = 61
  91. };
  92.  
  93. enum {
  94.     soundCmd                    = 80,
  95.     bufferCmd                    = 81,
  96.     rateCmd                        = 82,
  97.     continueCmd                    = 83,
  98.     doubleBufferCmd                = 84,
  99.     getRateCmd                    = 85,
  100.     sizeCmd                        = 90,
  101.     convertCmd                    = 91,
  102.     stdQLength                    = 128,
  103.     dataOffsetFlag                = 0x8000,
  104. /*channel initialization parameters*/
  105.     waveInitChannelMask            = 0x07,
  106.     waveInitChannel0            = 0x04,                            /*wave table only, Sound Manager 2.0 and earlier*/
  107.     waveInitChannel1            = 0x05,                            /*wave table only, Sound Manager 2.0 and earlier*/
  108.     waveInitChannel2            = 0x06,                            /*wave table only, Sound Manager 2.0 and earlier*/
  109.     waveInitChannel3            = 0x07,                            /*wave table only, Sound Manager 2.0 and earlier*/
  110.     initChan0                    = waveInitChannel0,                /*obsolete spelling*/
  111.     initChan1                    = waveInitChannel1,                /*obsolete spelling*/
  112.     initChan2                    = waveInitChannel2,                /*obsolete spelling*/
  113.     initChan3                    = waveInitChannel3,                /*obsolete spelling*/
  114.     initPanMask                    = 0x0003,                        /*mask for right/left pan values*/
  115.     initSRateMask                = 0x0030,                        /*mask for sample rate values*/
  116.     initStereoMask                = 0x00C0,                        /*mask for mono/stereo values*/
  117.     initCompMask                = 0xFF00                        /*mask for compression IDs*/
  118. };
  119.  
  120. enum {
  121.     initChanLeft                = 0x0002,                        /*left stereo channel*/
  122.     initChanRight                = 0x0003,                        /*right stereo channel*/
  123.     initNoInterp                = 0x0004,                        /*no linear interpolation*/
  124.     initNoDrop                    = 0x0008,                        /*no drop-sample conversion*/
  125.     initMono                    = 0x0080,                        /*monophonic channel*/
  126.     initStereo                    = 0x00C0,                        /*stereo channel*/
  127.     initMACE3                    = 0x0300,                        /*MACE 3:1*/
  128.     initMACE6                    = 0x0400,                        /*MACE 6:1*/
  129.     kUseOptionalOutputDevice    = -1,                            /*only for Sound Manager 3.0 or later*/
  130.     notCompressed                = 0,                            /*compression ID's*/
  131.     fixedCompression            = -1,                            /*compression ID for fixed-sized compression*/
  132.     variableCompression            = -2,                            /*compression ID for variable-sized compression*/
  133.     twoToOne                    = 1,
  134.     eightToThree                = 2,
  135.     threeToOne                    = 3,
  136.     sixToOne                    = 4
  137. };
  138.  
  139. enum {
  140.     stdSH                        = 0x00,                            /*Standard sound header encode value*/
  141.     extSH                        = 0xFF,                            /*Extended sound header encode value*/
  142.     cmpSH                        = 0xFE                            /*Compressed sound header encode value*/
  143. };
  144.  
  145. enum {
  146.     outsideCmpSH                = 0,                            /*MACE constants*/
  147.     insideCmpSH                    = 1,
  148.     aceSuccess                    = 0,
  149.     aceMemFull                    = 1,
  150.     aceNilBlock                    = 2,
  151.     aceBadComp                    = 3,
  152.     aceBadEncode                = 4,
  153.     aceBadDest                    = 5,
  154.     aceBadCmd                    = 6,
  155.     sixToOnePacketSize            = 8,
  156.     threeToOnePacketSize        = 16,
  157.     stateBlockSize                = 64,
  158.     leftOverBlockSize            = 32,
  159.     firstSoundFormat            = 0x0001,                        /*general sound format*/
  160.     secondSoundFormat            = 0x0002,                        /*special sampled sound format (HyperCard)*/
  161.     dbBufferReady                = 0x00000001,                    /*double buffer is filled*/
  162.     dbLastBuffer                = 0x00000004,                    /*last double buffer to play*/
  163.     sysBeepDisable                = 0x0000,                        /*SysBeep() enable flags*/
  164.     sysBeepEnable                = 0x0001,
  165.     unitTypeNoSelection            = 0xFFFF,                        /*unitTypes for AudioSelection.unitType*/
  166.     unitTypeSeconds                = 0x0000
  167. };
  168.  
  169. /*Structures for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!! */
  170. #if GENERATING68K
  171. enum {
  172.     swMode                        = -1,                            /*Sound Driver modes*/
  173.     ftMode                        = 1,
  174.     ffMode                        = 0
  175. };
  176.  
  177. typedef unsigned char FreeWave[30001];
  178.  
  179. struct FFSynthRec {
  180.     short                            mode;
  181.     Fixed                            count;
  182.     FreeWave                        waveBytes;
  183. };
  184. typedef struct FFSynthRec FFSynthRec;
  185.  
  186. typedef FFSynthRec *FFSynthPtr;
  187.  
  188. struct Tone {
  189.     short                            count;
  190.     short                            amplitude;
  191.     short                            duration;
  192. };
  193. typedef struct Tone Tone;
  194.  
  195. typedef Tone Tones[5001];
  196.  
  197. struct SWSynthRec {
  198.     short                            mode;
  199.     Tones                            triplets;
  200. };
  201. typedef struct SWSynthRec SWSynthRec;
  202.  
  203. typedef SWSynthRec *SWSynthPtr;
  204.  
  205. typedef unsigned char Wave[256];
  206.  
  207. typedef Wave *WavePtr;
  208.  
  209. struct FTSoundRec {
  210.     short                            duration;
  211.     Fixed                            sound1Rate;
  212.     long                            sound1Phase;
  213.     Fixed                            sound2Rate;
  214.     long                            sound2Phase;
  215.     Fixed                            sound3Rate;
  216.     long                            sound3Phase;
  217.     Fixed                            sound4Rate;
  218.     long                            sound4Phase;
  219.     WavePtr                            sound1Wave;
  220.     WavePtr                            sound2Wave;
  221.     WavePtr                            sound3Wave;
  222.     WavePtr                            sound4Wave;
  223. };
  224. typedef struct FTSoundRec FTSoundRec;
  225.  
  226. typedef FTSoundRec *FTSndRecPtr;
  227.  
  228. struct FTSynthRec {
  229.     short                            mode;
  230.     FTSndRecPtr                        sndRec;
  231. };
  232. typedef struct FTSynthRec FTSynthRec;
  233.  
  234. typedef FTSynthRec *FTSynthPtr;
  235.  
  236. typedef pascal void (*SndCompletionProcPtr)(void);
  237. #endif
  238. typedef unsigned long UnsignedFixed;
  239.  
  240. struct SndCommand {
  241.     unsigned short                    cmd;
  242.     short                            param1;
  243.     long                            param2;
  244. };
  245. typedef struct SndCommand SndCommand;
  246.  
  247. typedef struct SndChannel SndChannel;
  248.  
  249. typedef SndChannel *SndChannelPtr;
  250.  
  251. typedef pascal void (*SndCallBackProcPtr)(SndChannelPtr chan, SndCommand *cmd);
  252.  
  253. #if GENERATINGCFM
  254. typedef UniversalProcPtr SndCallBackUPP;
  255. #else
  256. typedef SndCallBackProcPtr SndCallBackUPP;
  257. #endif
  258.  
  259. struct SndChannel {
  260.     struct SndChannel                *nextChan;
  261.     Ptr                                firstMod;                    /* reserved for the Sound Manager */
  262.     SndCallBackUPP                    callBack;
  263.     long                            userInfo;
  264.     long                            wait;                        /* The following is for internal Sound Manager use only.*/
  265.     SndCommand                        cmdInProgress;
  266.     short                            flags;
  267.     short                            qLength;
  268.     short                            qHead;
  269.     short                            qTail;
  270.     SndCommand                        queue[stdQLength];
  271. };
  272. /*MACE structures*/
  273. struct StateBlock {
  274.     short                            stateVar[stateBlockSize];
  275. };
  276. typedef struct StateBlock StateBlock;
  277.  
  278. typedef StateBlock *StateBlockPtr;
  279.  
  280. struct LeftOverBlock {
  281.     unsigned long                    count;
  282.     char                            sampleArea[leftOverBlockSize];
  283. };
  284. typedef struct LeftOverBlock LeftOverBlock;
  285.  
  286. typedef LeftOverBlock *LeftOverBlockPtr;
  287.  
  288. struct ModRef {
  289.     unsigned short                    modNumber;
  290.     long                            modInit;
  291. };
  292. typedef struct ModRef ModRef;
  293.  
  294. struct SndListResource {
  295.     short                            format;
  296.     short                            numModifiers;
  297.     ModRef                            modifierPart[1];            /*This is a variable length array*/
  298.     short                            numCommands;
  299.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  300.     char                            dataPart[1];                /*This is a variable length array*/
  301. };
  302. typedef struct SndListResource SndListResource;
  303.  
  304. typedef SndListResource *SndListPtr;
  305.  
  306. typedef SndListPtr *SndListHndl, *SndListHandle;
  307.  
  308. /*HyperCard sound resource format*/
  309. struct Snd2ListResource {
  310.     short                            format;
  311.     short                            refCount;
  312.     short                            numCommands;
  313.     SndCommand                        commandPart[1];                /*This is a variable length array*/
  314.     char                            dataPart[1];                /*This is a variable length array*/
  315. };
  316. typedef struct Snd2ListResource Snd2ListResource;
  317.  
  318. typedef Snd2ListResource *Snd2ListPtr;
  319.  
  320. typedef Snd2ListPtr *Snd2ListHndl, *Snd2ListHandle;
  321.  
  322. struct SoundHeader {
  323.     Ptr                                samplePtr;                    /*if NIL then samples are in sampleArea*/
  324.     unsigned long                    length;                        /*length of sound in bytes*/
  325.     UnsignedFixed                    sampleRate;                    /*sample rate for this sound*/
  326.     unsigned long                    loopStart;                    /*start of looping portion*/
  327.     unsigned long                    loopEnd;                    /*end of looping portion*/
  328.     unsigned char                    encode;                        /*header encoding*/
  329.     unsigned char                    baseFrequency;                /*baseFrequency value*/
  330.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  331. };
  332. typedef struct SoundHeader SoundHeader;
  333.  
  334. typedef SoundHeader *SoundHeaderPtr;
  335.  
  336. struct CmpSoundHeader {
  337.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  338.     unsigned long                    numChannels;                /*number of channels i.e. mono = 1*/
  339.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  340.     unsigned long                    loopStart;                    /*loopStart of sound before compression*/
  341.     unsigned long                    loopEnd;                    /*loopEnd of sound before compression*/
  342.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  343.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  344.     unsigned long                    numFrames;                    /*length in frames ( packetFrames or sampleFrames )*/
  345.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  346.     Ptr                                markerChunk;                /*sync track*/
  347.     OSType                            format;                        /*data format type, was futureUse1*/
  348.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  349.     StateBlockPtr                    stateVars;                    /*pointer to State Block*/
  350.     LeftOverBlockPtr                leftOverSamples;            /*used to save truncated samples between compression calls*/
  351.     short                            compressionID;                /*0 means no compression, non zero means compressionID*/
  352.     unsigned short                    packetSize;                    /*number of bits in compressed sample packet*/
  353.     unsigned short                    snthID;                        /*resource ID of Sound Manager snth that contains NRT C/E*/
  354.     unsigned short                    sampleSize;                    /*number of bits in non-compressed sample*/
  355.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  356. };
  357. typedef struct CmpSoundHeader CmpSoundHeader;
  358.  
  359. typedef CmpSoundHeader *CmpSoundHeaderPtr;
  360.  
  361. struct ExtSoundHeader {
  362.     Ptr                                samplePtr;                    /*if nil then samples are in sample area*/
  363.     unsigned long                    numChannels;                /*number of channels,  ie mono = 1*/
  364.     UnsignedFixed                    sampleRate;                    /*sample rate in Apples Fixed point representation*/
  365.     unsigned long                    loopStart;                    /*same meaning as regular SoundHeader*/
  366.     unsigned long                    loopEnd;                    /*same meaning as regular SoundHeader*/
  367.     unsigned char                    encode;                        /*data structure used , stdSH, extSH, or cmpSH*/
  368.     unsigned char                    baseFrequency;                /*same meaning as regular SoundHeader*/
  369.     unsigned long                    numFrames;                    /*length in total number of frames*/
  370.     extended80                        AIFFSampleRate;                /*IEEE sample rate*/
  371.     Ptr                                markerChunk;                /*sync track*/
  372.     Ptr                                instrumentChunks;            /*AIFF instrument chunks*/
  373.     Ptr                                AESRecording;
  374.     unsigned short                    sampleSize;                    /*number of bits in sample*/
  375.     unsigned short                    futureUse1;                    /*reserved by Apple*/
  376.     unsigned long                    futureUse2;                    /*reserved by Apple*/
  377.     unsigned long                    futureUse3;                    /*reserved by Apple*/
  378.     unsigned long                    futureUse4;                    /*reserved by Apple*/
  379.     unsigned char                    sampleArea[1];                /*space for when samples follow directly*/
  380. };
  381. typedef struct ExtSoundHeader ExtSoundHeader;
  382.  
  383. typedef ExtSoundHeader *ExtSoundHeaderPtr;
  384.  
  385. struct ConversionBlock {
  386.     short                            destination;
  387.     short                            unused;
  388.     CmpSoundHeaderPtr                inputPtr;
  389.     CmpSoundHeaderPtr                outputPtr;
  390. };
  391. typedef struct ConversionBlock ConversionBlock;
  392.  
  393. typedef ConversionBlock *ConversionBlockPtr;
  394.  
  395. struct SMStatus {
  396.     short                            smMaxCPULoad;
  397.     short                            smNumChannels;
  398.     short                            smCurCPULoad;
  399. };
  400. typedef struct SMStatus SMStatus;
  401.  
  402. typedef SMStatus *SMStatusPtr;
  403.  
  404. struct SCStatus {
  405.     UnsignedFixed                    scStartTime;
  406.     UnsignedFixed                    scEndTime;
  407.     UnsignedFixed                    scCurrentTime;
  408.     Boolean                            scChannelBusy;
  409.     Boolean                            scChannelDisposed;
  410.     Boolean                            scChannelPaused;
  411.     Boolean                            scUnused;
  412.     unsigned long                    scChannelAttributes;
  413.     long                            scCPULoad;
  414. };
  415. typedef struct SCStatus SCStatus;
  416.  
  417. typedef SCStatus *SCStatusPtr;
  418.  
  419. struct AudioSelection {
  420.     long                            unitType;
  421.     UnsignedFixed                    selStart;
  422.     UnsignedFixed                    selEnd;
  423. };
  424. typedef pascal void (*FilePlayCompletionProcPtr)(SndChannelPtr chan);
  425.  
  426. #if GENERATINGCFM
  427. typedef UniversalProcPtr FilePlayCompletionUPP;
  428. #else
  429. typedef FilePlayCompletionProcPtr FilePlayCompletionUPP;
  430. #endif
  431.  
  432. enum {
  433.     uppFilePlayCompletionProcInfo = kPascalStackBased
  434.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  435. };
  436.  
  437. #if GENERATINGCFM
  438. #define NewFilePlayCompletionProc(userRoutine)        \
  439.         (FilePlayCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, GetCurrentArchitecture())
  440. #else
  441. #define NewFilePlayCompletionProc(userRoutine)        \
  442.         ((FilePlayCompletionUPP) (userRoutine))
  443. #endif
  444.  
  445. #if GENERATINGCFM
  446. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  447.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFilePlayCompletionProcInfo, (chan))
  448. #else
  449. #define CallFilePlayCompletionProc(userRoutine, chan)        \
  450.         (*(userRoutine))((chan))
  451. #endif
  452.  
  453. typedef struct AudioSelection AudioSelection;
  454.  
  455. typedef AudioSelection *AudioSelectionPtr;
  456.  
  457. struct SndDoubleBuffer {
  458.     long                            dbNumFrames;
  459.     long                            dbFlags;
  460.     long                            dbUserInfo[2];
  461.     char                            dbSoundData[1];
  462. };
  463. typedef struct SndDoubleBuffer SndDoubleBuffer;
  464.  
  465. typedef SndDoubleBuffer *SndDoubleBufferPtr;
  466.  
  467. typedef pascal void (*SndDoubleBackProcPtr)(SndChannelPtr channel, SndDoubleBufferPtr doubleBufferPtr);
  468.  
  469. #if GENERATINGCFM
  470. typedef UniversalProcPtr SndDoubleBackUPP;
  471. #else
  472. typedef SndDoubleBackProcPtr SndDoubleBackUPP;
  473. #endif
  474.  
  475. enum {
  476.     uppSndDoubleBackProcInfo = kPascalStackBased
  477.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  478.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndDoubleBufferPtr)))
  479. };
  480.  
  481. #if GENERATINGCFM
  482. #define NewSndDoubleBackProc(userRoutine)        \
  483.         (SndDoubleBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndDoubleBackProcInfo, GetCurrentArchitecture())
  484. #else
  485. #define NewSndDoubleBackProc(userRoutine)        \
  486.         ((SndDoubleBackUPP) (userRoutine))
  487. #endif
  488.  
  489. #if GENERATINGCFM
  490. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  491.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndDoubleBackProcInfo, (channel), (doubleBufferPtr))
  492. #else
  493. #define CallSndDoubleBackProc(userRoutine, channel, doubleBufferPtr)        \
  494.         (*(userRoutine))((channel), (doubleBufferPtr))
  495. #endif
  496.  
  497. struct SndDoubleBufferHeader {
  498.     short                            dbhNumChannels;
  499.     short                            dbhSampleSize;
  500.     short                            dbhCompressionID;
  501.     short                            dbhPacketSize;
  502.     UnsignedFixed                    dbhSampleRate;
  503.     SndDoubleBufferPtr                dbhBufferPtr[2];
  504.     SndDoubleBackUPP                dbhDoubleBack;
  505. };
  506. typedef struct SndDoubleBufferHeader SndDoubleBufferHeader;
  507.  
  508. typedef SndDoubleBufferHeader *SndDoubleBufferHeaderPtr;
  509.  
  510. struct SndDoubleBufferHeader2 {
  511.     short                            dbhNumChannels;
  512.     short                            dbhSampleSize;
  513.     short                            dbhCompressionID;
  514.     short                            dbhPacketSize;
  515.     UnsignedFixed                    dbhSampleRate;
  516.     SndDoubleBufferPtr                dbhBufferPtr[2];
  517.     SndDoubleBackUPP                dbhDoubleBack;
  518.     OSType                            dbhFormat;
  519. };
  520. typedef struct SndDoubleBufferHeader2 SndDoubleBufferHeader2;
  521.  
  522. typedef SndDoubleBufferHeader2 *SndDoubleBufferHeader2Ptr;
  523.  
  524. struct SoundInfoList {
  525.     short                            count;
  526.     Handle                            infoHandle;
  527. };
  528. typedef struct SoundInfoList SoundInfoList;
  529.  
  530. typedef SoundInfoList *SoundInfoListPtr;
  531.  
  532. extern pascal OSErr SndDoCommand(SndChannelPtr chan, const SndCommand *cmd, Boolean noWait)
  533.  ONEWORDINLINE(0xA803);
  534. extern pascal OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand *cmd)
  535.  ONEWORDINLINE(0xA804);
  536. extern pascal OSErr SndNewChannel(SndChannelPtr *chan, short synth, long init, SndCallBackUPP userRoutine)
  537.  ONEWORDINLINE(0xA807);
  538. extern pascal OSErr SndDisposeChannel(SndChannelPtr chan, Boolean quietNow)
  539.  ONEWORDINLINE(0xA801);
  540. extern pascal OSErr SndPlay(SndChannelPtr chan, Handle sndHdl, Boolean async)
  541.  ONEWORDINLINE(0xA805);
  542. extern pascal OSErr SndAddModifier(SndChannelPtr chan, Ptr modifier, short id, long init)
  543.  ONEWORDINLINE(0xA802);
  544. extern pascal OSErr SndControl(short id, SndCommand *cmd)
  545.  ONEWORDINLINE(0xA806);
  546. #if GENERATING68K
  547. extern pascal void SetSoundVol(short level);
  548.  
  549. #if !GENERATINGCFM
  550. #pragma parameter GetSoundVol(__A0)
  551. #endif
  552. extern pascal void GetSoundVol(short *level)
  553.  THREEWORDINLINE(0x4218, 0x10B8, 0x0260);
  554. #endif
  555. extern pascal NumVersion SndSoundManagerVersion(void)
  556.  FOURWORDINLINE(0x203C, 0x000C, 0x0008, 0xA800);
  557. extern pascal OSErr SndStartFilePlay(SndChannelPtr chan, short fRefNum, short resNum, long bufferSize, void *theBuffer, AudioSelectionPtr theSelection, FilePlayCompletionUPP theCompletion, Boolean async)
  558.  FOURWORDINLINE(0x203C, 0x0D00, 0x0008, 0xA800);
  559. extern pascal OSErr SndPauseFilePlay(SndChannelPtr chan)
  560.  FOURWORDINLINE(0x203C, 0x0204, 0x0008, 0xA800);
  561. extern pascal OSErr SndStopFilePlay(SndChannelPtr chan, Boolean quietNow)
  562.  FOURWORDINLINE(0x203C, 0x0308, 0x0008, 0xA800);
  563. extern pascal OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
  564.  FOURWORDINLINE(0x203C, 0x0010, 0x0008, 0xA800);
  565. extern pascal OSErr SndManagerStatus(short theLength, SMStatusPtr theStatus)
  566.  FOURWORDINLINE(0x203C, 0x0014, 0x0008, 0xA800);
  567. extern pascal void SndGetSysBeepState(short *sysBeepState)
  568.  FOURWORDINLINE(0x203C, 0x0018, 0x0008, 0xA800);
  569. extern pascal OSErr SndSetSysBeepState(short sysBeepState)
  570.  FOURWORDINLINE(0x203C, 0x001C, 0x0008, 0xA800);
  571. extern pascal OSErr SndPlayDoubleBuffer(SndChannelPtr chan, SndDoubleBufferHeaderPtr theParams)
  572.  FOURWORDINLINE(0x203C, 0x0020, 0x0008, 0xA800);
  573. extern pascal NumVersion MACEVersion(void)
  574.  FOURWORDINLINE(0x203C, 0x0000, 0x0010, 0xA800);
  575. extern pascal void Comp3to1(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  576.  FOURWORDINLINE(0x203C, 0x0004, 0x0010, 0xA800);
  577. extern pascal void Exp1to3(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  578.  FOURWORDINLINE(0x203C, 0x0008, 0x0010, 0xA800);
  579. extern pascal void Comp6to1(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  580.  FOURWORDINLINE(0x203C, 0x000C, 0x0010, 0xA800);
  581. extern pascal void Exp1to6(const void *inBuffer, void *outBuffer, unsigned long cnt, const void *inState, void *outState, unsigned long numChannels, unsigned long whichChannel)
  582.  FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xA800);
  583. /*Sound Manager 3.0 and later calls*/
  584. extern pascal OSErr GetSysBeepVolume(long *level)
  585.  FOURWORDINLINE(0x203C, 0x0224, 0x0018, 0xA800);
  586. extern pascal OSErr SetSysBeepVolume(long level)
  587.  FOURWORDINLINE(0x203C, 0x0228, 0x0018, 0xA800);
  588. extern pascal OSErr GetDefaultOutputVolume(long *level)
  589.  FOURWORDINLINE(0x203C, 0x022C, 0x0018, 0xA800);
  590. extern pascal OSErr SetDefaultOutputVolume(long level)
  591.  FOURWORDINLINE(0x203C, 0x0230, 0x0018, 0xA800);
  592. extern pascal OSErr GetSoundHeaderOffset(Handle sndHandle, long *offset)
  593.  FOURWORDINLINE(0x203C, 0x0404, 0x0018, 0xA800);
  594. extern pascal UnsignedFixed UnsignedFixMulDiv(UnsignedFixed value, UnsignedFixed multiplier, UnsignedFixed divisor)
  595.  FOURWORDINLINE(0x203C, 0x060C, 0x0018, 0xA800);
  596. extern pascal OSErr SetSoundPreference(OSType theType, Str255 name, Handle settings)
  597.  FOURWORDINLINE(0x203C, 0x0634, 0x0018, 0xA800);
  598. extern pascal OSErr GetSoundPreference(OSType theType, Str255 name, Handle settings)
  599.  FOURWORDINLINE(0x203C, 0x0638, 0x0018, 0xA800);
  600. enum {
  601.     uppSndCallBackProcInfo = kPascalStackBased
  602.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SndChannelPtr)))
  603.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SndCommand*)))
  604. };
  605.  
  606. #if GENERATINGCFM
  607. #define NewSndCallBackProc(userRoutine)        \
  608.         (SndCallBackUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSndCallBackProcInfo, GetCurrentArchitecture())
  609. #else
  610. #define NewSndCallBackProc(userRoutine)        \
  611.         ((SndCallBackUPP) (userRoutine))
  612. #endif
  613.  
  614. #if GENERATINGCFM
  615. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  616.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppSndCallBackProcInfo, (chan), (cmd))
  617. #else
  618. #define CallSndCallBackProc(userRoutine, chan, cmd)        \
  619.         (*(userRoutine))((chan), (cmd))
  620. #endif
  621.  
  622.  
  623. #ifdef __CFM68K__
  624. #pragma lib_export off
  625. #endif
  626.  
  627. #if GENERATINGPOWERPC
  628. #pragma options align=reset
  629. #endif
  630.  
  631. #ifdef __cplusplus
  632. }
  633. #endif
  634.  
  635. #endif /* __SOUND__ */
  636.